<?php class Model_Download_Addemail extends ypModel {	public function addEmail($email) {		$this->Db->query("SELECT * FROM `yp_download_email_list` WHERE `email` = '". $this->Db->e(urldecode($email)) . "'");		if ($this->Db->num_rows() == 0) {			$this->Db->query("INSERT INTO `yp_download_email_list` (`email`)			VALUES ('". $this->Db->e(urldecode($email)) ."')");		} else {			$this->Db->query("UPDATE `yp_download_email_list` SET `download` = `download` + 1 			WHERE `email` = '". $this->Db->e(urldecode($email)) ."'");		}	}		public function addListWaiting($code, $email, $file_id, $active) {		return $this->Db->query("INSERT INTO `yp_download_list_waiting` (`code`, `email`, `file_id`, `active`) 		VALUES ('". $this->Db->e($code) ."', '". $this->Db->e($email) ."', ". (int)$file_id .", ". (int)$active .")");	}}